//消息框
//用法：显示消息框，隐藏消息框
var messageBox = {
	Show : function(message, parentNode, xpos, ypos, showtime){

		var winSize = cc.director.getWinSize();
		
		var oldbox = parentNode.getChildByName("MessageBox");
		if (oldbox != null)
			oldbox.removeFromParent();
				
		var newBox = cc.LabelTTF.create(message, "simhei", 26);
		newBox.setName("MessageBox");
		xpos = xpos || (0.5 * winSize.width);
		ypos = ypos || (40 + 0.5 * newBox.height);
		newBox.attr({
			anchorX : 0.5,
			anchorY : 0.5,
			x : xpos,
			y : ypos
		});
		var labelBackground = new cc.Sprite(resource.white1010_png);
		labelBackground.attr({
			x : 0.5 * newBox.width,
			y : 0.5 * newBox.height,
			color : cc.color(0,0,0),
			scaleX : (newBox.width + 20) * 0.1,
			scaleY : (newBox.height + 20) * 0.1,
		});
		newBox.addChild(labelBackground, -1);
		
		parentNode.addChild(newBox, 999);
		
		showtime = showtime || 3.0;
		newBox.runAction(cc.sequence(cc.delayTime(showtime), cc.fadeOut(2.0), cc.removeSelf()));
	},
}